package ioc05;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Map;

public class Test {
    public static void main(String[] args) {
        ApplicationContext ac = new ClassPathXmlApplicationContext("ioc05/spring.xml");
        SomeBean someBean = (SomeBean) ac.getBean("someBean");
        someBean.doSome();

        //练习1  将Map这个对象交给spring管理
        //Map<String, String> map = System.getenv();
        //通过ac.getBean("map")获取
        Map map = (Map) ac.getBean("map");
        System.out.println(map);

        //练习2
        //String java_home = System.getenv("JAVA_HOME");
        String java_home = (String) ac.getBean("java_home");
        System.out.println(java_home);
    }
}
